//
//  PlushAnimation.m
//  diaoyuren
//
//  Created by 钓鱼人 on 16/1/19.
//  Copyright © 2016年 game. All rights reserved.
//

#import "PlushAnimation.h"
#import "PlusSignController.h"
#import "IslanInforChangeCtl.h"
#import "LoginController.h"
#import "MenuLabel.h"
#import "HyPopMenuView.h"
#import "POP.h"

#define Objs @[[MenuLabel CreatelabelIconName:@"yuhuo" Title:@"发渔获"],[MenuLabel CreatelabelIconName:@"wenda" Title:@"问技巧"],[MenuLabel CreatelabelIconName:@"zhuangbei" Title:@"晒渔具"],[MenuLabel CreatelabelIconName:@"zhuangbei" Title:@"加钓场"],[MenuLabel CreatelabelIconName:@"jiayujudian" Title:@"加渔具店"],]

@interface PlushAnimation ()


@end

@implementation PlushAnimation


+ (void)showMenu
{
    
    UIViewController *appRootViewController;
    UIWindow *window;
    
    window = [UIApplication sharedApplication].keyWindow;
    
    appRootViewController = window.rootViewController;
    
    UIViewController *topViewController = appRootViewController;

    
    CGFloat x,y,w,h;
    x = SCREEN_WIDTH/2 - 213/2;
    y = CGRectGetHeight([UIScreen mainScreen].bounds)/2 * 0.3f;
    w = 213;
    h = 57;
    
    //自定义的头部视图
    UIImageView *topView = [[ImageView alloc] initWithFrame:CGRectMake(x, y, w, h)];
    topView.image = [UIImage imageNamed:@"txt"];
    topView.contentMode = UIViewContentModeScaleAspectFit;
    
    NSMutableDictionary *AudioDictionary = [NSMutableDictionary dictionary];
    
  
    [HyPopMenuView CreatingPopMenuObjectItmes:Objs TopView:topView /*nil*/OpenOrCloseAudioDictionary:AudioDictionary /*nil*/ SelectdCompletionBlock:^(MenuLabel *menuLabel, NSInteger index) {
        
       AppDelegate * app = (AppDelegate *)[UIApplication sharedApplication].delegate;

        if (![app.isLogin isEqualToString:@"YES"]) {
            
            LoginController *login = [LoginController new];
            
            [topViewController presentViewController:login animated:YES completion:nil];
           
            
        }else{
            
        if (index==0) {//发渔获
            PlusSignController *plus = [PlusSignController new];
            plus.fid = @"2";
            [topViewController presentViewController:plus animated:YES completion:nil];
        }
        
        if (index==1) {//问技巧
            PlusSignController *plus = [PlusSignController new];
            plus.fid = @"36";
            [topViewController presentViewController:plus animated:YES completion:nil];
        }
        
        if (index==2) {//晒渔具
            PlusSignController *plus = [PlusSignController new];
            plus.fid = @"47";
            [topViewController presentViewController:plus animated:YES completion:nil];
        }
        
        if (index==3) {//加钓场
            IslanInforChangeCtl *change = [IslanInforChangeCtl new];
            change.number=30;
            [topViewController presentViewController:change animated:YES completion:nil];
        }
        
        if (index==4) {//加渔具店
            IslanInforChangeCtl *change = [IslanInforChangeCtl new];
            change.number=40;
            change.isYuJuDian = YES;
            [topViewController presentViewController:change animated:YES completion:nil];
        }
            
    }
    }];
}


@end
